import constants
# from rest_framework.generics import ListAPIView
from lcityapi.utils.views import CacheListAPIView
from .models import Nav, Banner
from .serializers import NavModelSerializer,BannerModelSerializer

class NavHeaderListAPIView(CacheListAPIView):
    queryset = Nav.objects.filter(
        position=constants.NAV_HEADER_POSITION,
        is_show=True,
        is_deleted=False
    ).order_by('orders','-id')[:constants.NAV_HEADER_SIZE]
    serializer_class = NavModelSerializer


class NavFooterListAPIView(CacheListAPIView):
    queryset = Nav.objects.filter(
        position=constants.NAV_FOOTER_POSITION,
        is_show=True,
        is_deleted=False
    ).order_by('orders','-id')[:constants.NAV_FOOTER_SIZE]
    serializer_class = NavModelSerializer


class BannerListAPIView(CacheListAPIView):
    queryset = Banner.objects.filter(
        is_show=True,
        is_deleted=False
    ).order_by("orders","-id")[:constants.BANNER_SIZE]
    serializer_class = BannerModelSerializer
